#ifndef _SIMULATION_LCD_H_
#define _SIMULATION_LCD_H_	

#include "stm32f10x.h"
#include "systick.h" 
#include "stdlib.h"

typedef struct  
{										    
	uint16_t width;			// LCD 宽度
	uint16_t height;	    // LCD 高度
	uint16_t id;		    // LCD ID
	uint8_t  dir;			// 横屏还是竖屏控制：0，竖屏；1，横屏。	
	
	uint8_t	 wramcmd;		// 开始写gram指令
	uint8_t  setxcmd;		// 设置x坐标指令
	uint8_t  setycmd;		// 设置y坐标指令	 
}SimulationLCD_t; 	  
extern SimulationLCD_t SimulationLCD;	//管理LCD重要参数

//LCD的画笔颜色和背景色	 
extern uint16_t SimulationLCD_PointColor;// 画笔颜色
extern uint16_t SimulationLCD_BackColor;// 背景色

//扫描方向定义
#define SimulationLCD_L2R_U2D  0 //从左到右,从上到下
#define SimulationLCD_L2R_D2U  1 //从左到右,从下到上
#define SimulationLCD_R2L_U2D  2 //从右到左,从上到下
#define SimulationLCD_R2L_D2U  3 //从右到左,从下到上

#define SimulationLCD_U2D_L2R  4 //从上到下,从左到右
#define SimulationLCD_U2D_R2L  5 //从上到下,从右到左
#define SimulationLCD_D2U_L2R  6 //从下到上,从左到右
#define SimulationLCD_D2U_R2L  7 //从下到上,从右到左

// 默认的扫描方向
#define SimulationLCD_DefScanDir  SimulationLCD_L2R_U2D  

void SimulationLCD_Init(void);
void SimulationLCD_Clear(uint16_t color);
void SimulationLCD_DrawPoint(uint16_t x, uint16_t y);
uint16_t SimulationLCD_ReadPoint(uint16_t x, uint16_t y);
void SimulationLCD_Fill(uint16_t sx,uint16_t sy,uint16_t ex,uint16_t ey,uint16_t color);
void SimulationLCD_ColorFill(uint16_t sx,uint16_t sy,uint16_t ex,uint16_t ey,uint16_t *color);
void SimulationLCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
void SimulationLCD_DrawCircle(uint16_t x0,uint16_t y0,uint8_t r);
void SimulationLCD_DrawRectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
void SimulationLCD_ShowNum(uint16_t x,uint16_t y,uint32_t num,uint8_t len,uint8_t size);
void SimulationLCD_ShowxNum(uint16_t x,uint16_t y,uint32_t num,uint8_t len,uint8_t size,uint8_t mode);
void SimulationLCD_ShowString(uint16_t x,uint16_t y,uint16_t width,uint16_t height,uint8_t size,uint8_t *p);

void SimulationLCD_Show_PM2_5(uint16_t x, uint16_t y);
void SimulationLCD_Show_ug_m3(uint16_t x, uint16_t y);
void SimulationLCD_Show_PM1_0(uint16_t x, uint16_t y);
void SimulationLCD_Show_PM10(uint16_t x, uint16_t y);

void SimulationLCD_ShowPM2_5_Num(uint16_t x,uint16_t y,uint32_t num);
void SimulationLCD_ShowPM1_0_Num(uint16_t x,uint16_t y,uint32_t num);
void SimulationLCD_ShowPM10_Num(uint16_t x,uint16_t y,uint32_t num);

void SimulationLCD_ShowBatteryShape(void);
void SimulationLCD_ShowRun(void);
//画笔颜色
#define SimulationLCD_WHITE         	 0xFFFF
#define SimulationLCD_BLACK         	 0x0000	  
#define SimulationLCD_BLUE         	     0x001F  
#define SimulationLCD_BRED               0XF81F
#define SimulationLCD_GRED 			     0XFFE0
#define SimulationLCD_GBLUE			     0X07FF
#define SimulationLCD_RED           	 0xF800
#define SimulationLCD_MAGENTA       	 0xF81F
#define SimulationLCD_GREEN         	 0x07E0
#define SimulationLCD_CYAN          	 0x7FFF
#define SimulationLCD_YELLOW        	 0xFFE0
#define SimulationLCD_BROWN 			 0XBC40 //棕色
#define SimulationLCD_BRRED 			 0XFC07 //棕红色
#define SimulationLCD_GRAY  			 0X8430 //灰色
//GUI颜色
#define SimulationLCD_DARKBLUE      	 0X01CF	//深蓝色
#define SimulationLCD_LIGHTBLUE      	 0X7D7C	//浅蓝色  
#define SimulationLCD_GRAYBLUE       	 0X5458 //灰蓝色
//以上三色为PANEL的颜色 
#define SimulationLCD_LIGHTGREEN     	 0X841F //浅绿色
//#define SimulationLCD_LIGHTGRAY        0XEF5B //浅灰色(PANNEL)
#define SimulationLCD_LGRAY 			 0XC618 //浅灰色(PANNEL),窗体背景色

#define SimulationLCD_LGRAYBLUE        0XA651 //浅灰蓝色(中间层颜色)
#define SimulationLCD_LBBLUE           0X2B12 //浅棕蓝色(选择条目的反色)

//9320/9325 LCD寄存器  
#define SimulationLCD_R0             0x00
#define SimulationLCD_R1             0x01
#define SimulationLCD_R2             0x02
#define SimulationLCD_R3             0x03
#define SimulationLCD_R4             0x04
#define SimulationLCD_R5             0x05
#define SimulationLCD_R6             0x06
#define SimulationLCD_R7             0x07
#define SimulationLCD_R8             0x08
#define SimulationLCD_R9             0x09
#define SimulationLCD_R10            0x0A
#define SimulationLCD_R12            0x0C
#define SimulationLCD_R13            0x0D
#define SimulationLCD_R14            0x0E
#define SimulationLCD_R15            0x0F
#define SimulationLCD_R16            0x10
#define SimulationLCD_R17            0x11
#define SimulationLCD_R18            0x12
#define SimulationLCD_R19            0x13
#define SimulationLCD_R20            0x14
#define SimulationLCD_R21            0x15
#define SimulationLCD_R22            0x16
#define SimulationLCD_R23            0x17
#define SimulationLCD_R24            0x18
#define SimulationLCD_R25            0x19
#define SimulationLCD_R26            0x1A
#define SimulationLCD_R27            0x1B
#define SimulationLCD_R28            0x1C
#define SimulationLCD_R29            0x1D
#define SimulationLCD_R30            0x1E
#define SimulationLCD_R31            0x1F
#define SimulationLCD_R32            0x20
#define SimulationLCD_R33            0x21
#define SimulationLCD_R34            0x22
#define SimulationLCD_R36            0x24
#define SimulationLCD_R37            0x25
#define SimulationLCD_R40            0x28
#define SimulationLCD_R41            0x29
#define SimulationLCD_R43            0x2B
#define SimulationLCD_R45            0x2D
#define SimulationLCD_R48            0x30
#define SimulationLCD_R49            0x31
#define SimulationLCD_R50            0x32
#define SimulationLCD_R51            0x33
#define SimulationLCD_R52            0x34
#define SimulationLCD_R53            0x35
#define SimulationLCD_R54            0x36
#define SimulationLCD_R55            0x37
#define SimulationLCD_R56            0x38
#define SimulationLCD_R57            0x39
#define SimulationLCD_R59            0x3B
#define SimulationLCD_R60            0x3C
#define SimulationLCD_R61            0x3D
#define SimulationLCD_R62            0x3E
#define SimulationLCD_R63            0x3F
#define SimulationLCD_R64            0x40
#define SimulationLCD_R65            0x41
#define SimulationLCD_R66            0x42
#define SimulationLCD_R67            0x43
#define SimulationLCD_R68            0x44
#define SimulationLCD_R69            0x45
#define SimulationLCD_R70            0x46
#define SimulationLCD_R71            0x47
#define SimulationLCD_R72            0x48
#define SimulationLCD_R73            0x49
#define SimulationLCD_R74            0x4A
#define SimulationLCD_R75            0x4B
#define SimulationLCD_R76            0x4C
#define SimulationLCD_R77            0x4D
#define SimulationLCD_R78            0x4E
#define SimulationLCD_R79            0x4F
#define SimulationLCD_R80            0x50
#define SimulationLCD_R81            0x51
#define SimulationLCD_R82            0x52
#define SimulationLCD_R83            0x53
#define SimulationLCD_R96            0x60
#define SimulationLCD_R97            0x61
#define SimulationLCD_R106           0x6A
#define SimulationLCD_R118           0x76
#define SimulationLCD_R128           0x80
#define SimulationLCD_R129           0x81
#define SimulationLCD_R130           0x82
#define SimulationLCD_R131           0x83
#define SimulationLCD_R132           0x84
#define SimulationLCD_R133           0x85
#define SimulationLCD_R134           0x86
#define SimulationLCD_R135           0x87
#define SimulationLCD_R136           0x88
#define SimulationLCD_R137           0x89
#define SimulationLCD_R139           0x8B
#define SimulationLCD_R140           0x8C
#define SimulationLCD_R141           0x8D
#define SimulationLCD_R143           0x8F
#define SimulationLCD_R144           0x90
#define SimulationLCD_R145           0x91
#define SimulationLCD_R146           0x92
#define SimulationLCD_R147           0x93
#define SimulationLCD_R148           0x94
#define SimulationLCD_R149           0x95
#define SimulationLCD_R150           0x96
#define SimulationLCD_R151           0x97
#define SimulationLCD_R152           0x98
#define SimulationLCD_R153           0x99
#define SimulationLCD_R154           0x9A
#define SimulationLCD_R157           0x9D
#define SimulationLCD_R192           0xC0
#define SimulationLCD_R193           0xC1
#define SimulationLCD_R229           0xE5	

#endif  
	 
	 



